package com.cx.service.impl;

import com.cx.mapper.CartsMapper;
import com.cx.mapper.GoodCollectionMapper;
import com.cx.mapper.GoodDetailMapper;
import com.cx.pojo.Carts;
import com.cx.pojo.GoodDetail;
import com.cx.service.GoodDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author ：zhangjie
 * @Description :
 */
@Service
public class GoodDetailServiceimpl implements GoodDetailService {
    @Autowired
    private GoodDetailMapper goodDetailMapper;

    @Autowired
    private CartsMapper cartsMapper;

    @Autowired
    private GoodCollectionMapper goodCollectionMapper;

    @Override
    public GoodDetail selectById(Integer id) {
        return goodDetailMapper.selectById(id);
    }

    @Override
    public int insert(Carts carts) {
        return cartsMapper.insert(carts);
    }

    @Override
    public List<Integer> selectGoodId(Integer id) {
        return goodDetailMapper.selectGoodId(id);
    }

    @Override
    public List<Carts> selectByUserId(Integer id) {
        return cartsMapper.selectByUserId(id);
    }

    @Override
    public int insertCollection(Integer userId, Integer goodId) {
        return goodCollectionMapper.insertCollection(userId,goodId);
    }

    @Override
    public int deleteByGoodId(Integer goodId) {
        return goodCollectionMapper.deleteByGoodId(goodId);
    }

    @Override
    public int updateByGoodId(Carts carts) {
        return cartsMapper.updateByGoodId(carts);
    }

    @Override
    public GoodDetail selectBySeckillId(Integer id) {
        return goodDetailMapper.selectBySeckillId(id);
    }


}
